# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=nymphcast
pkgver=0.1
pkgrel=10
# s390x and riscv64 blocked by vlc
arch="all !s390x !riscv64"
url="http://nyanko.ws/product_nymphcast.php"
pkgdesc="Audio and video casting system with support for custom applications"
license="BSD-3-Clause"
depends="avahi"
makedepends="
	alsa-lib-dev
	curl-dev
	ffmpeg-dev
	freeimage-dev
	freetype-dev
	libnymphcast-dev
	nymphrpc-dev
	openssl-dev>3
	qt5-qtbase-dev
	rapidjson-dev
	sdl2-dev
	sdl2_image-dev
	vlc-dev
	"
subpackages="$pkgname-openrc $pkgname-client $pkgname-nftables"
source="https://github.com/MayaPosch/NymphCast/archive/v$pkgver/nymphcast-v$pkgver.tar.gz
	ffmpeg6.patch
	gcc12.patch
	gcc13.patch
	lfs64.patch
	60_nymphcast.nft
	"
options="!check" # No tests
builddir="$srcdir/NymphCast-$pkgver"

build() {
	make -C src/server

	cd player/NymphCastPlayer
	qmake-qt5 PREFIX=/usr
	make
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr -C src/server install
	make DESTDIR="$pkgdir" PREFIX=/usr -C src/server install-openrc
}

client() {
	cd "$builddir"/player/NymphCastPlayer
	make INSTALL_ROOT="$subpkgdir" install
}

nftables() {
	pkgdesc="$pkgdesc (nftables rules)"
	install_if="$pkgname=$pkgver-r$pkgrel nftables"

	install -Dm644 -t "$subpkgdir"/etc/nftables.d "$srcdir"/60_nymphcast.nft
}

sha512sums="
c498623fc3506789876cffbd734b6ac39c2a937ad7c9d8d62f6ccc44860d3135d97276afdee3c9e207ad8f8ce0ddbd9770470a6ba935546028d307af3cfc71a4  nymphcast-v0.1.tar.gz
40550af559230248f4a4a0f00c52e6ab6120ae6cdf5a3268d31abd57fd4bd6fd65f10c56669204896e74214559985bf93348632fb6d7a3b353ef40023833bef7  ffmpeg6.patch
6628f67f9f778634d77a8bd42ff2ff39031c0ef3b873a22882f04f00892d129a22f1679f4518a8e0bf08a66477f161ea2ce927d39ece3c63b7904f0b8a5226d0  gcc12.patch
95e1b87647fa99da17ffcebc8659abc56439a3ac01efe596bac2cd59bf4c19881c011db67019778a7f3783f8277327e2a0ca234b65d4ffc17cf4806885777b25  gcc13.patch
551c473e63a22505221a70a422b57f6468d2a4c0f2ba48a61b6305598a02f7a2c08306747216a9c38fbf1f38fb17cca0c7dd2e2796434dbbaca35e3e790cd042  lfs64.patch
fba04b7fc8c9a4cbab57b20ba2f8e7274e759165e5b0830590796da4a955f3c843b7516cf6bd34d8d82523328d95932610554b2f0decf051b1cc7022319f6b37  60_nymphcast.nft
"
